package com.changgou.order.listener;

import com.changgou.order.config.RabbitMQConfig;
import com.changgou.order.pojo.Order;
import com.changgou.order.service.OrderService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author LQQ
 * @Date 2020/3/17 14:43
 * @Version 1.0
 */
@Component
public class OrderTaskListener {
    @Autowired
    private OrderService orderService;

    /**
     * 自动确认收货
     *
     * @param message
     */

    @RabbitListener(queues = RabbitMQConfig.ORDER_PAY)
    public void receiveOrderTaskMessage(String message) {
        System.out.println("接收到自动收货的消息");

        //调用业务层,完成自动收货实现
        orderService.autoTack();
    }
}
